👌 IMPROVE: MathJax 4 compatibility (Sphinx 9)#1110
Merged
chrisjsewell merged 5 commits intoexecutablebooks:masterfrom May 8, 2026
Merged
👌 IMPROVE: MathJax 4 compatibility (Sphinx 9)#1110chrisjsewell merged 5 commits intoexecutablebooks:masterfrom
chrisjsewell merged 5 commits intoexecutablebooks:masterfrom
Conversation
for more information, see https://pre-commit.ci
- Remove dead Sphinx 3 / MathJax 2 code path (`mathjax_config['tex2jax']`) since only Sphinx >=8 is supported. - Add mathjax4_config support for Sphinx 9, preferring whichever config the user has explicitly set. - Fix default case: processHtmlClass is now always applied even when no user mathjax config is set. - Simplify log_override_warning to use the actual config attribute name instead of a version number. - Add tests for default config, myst_update_mathjax=False, and mathjax4_config override warning (Sphinx 9 only).
Member
|
Thanks @ilia-kats , I took the chance to do a bit more cleaning up of the code, and updated the pr description |
chrisjsewell
approved these changes
May 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Sphinx 9 introduced
mathjax4_configalongside the existingmathjax3_config. This PR updates MyST-Parser's mathjax override logic to handle both.Changes
mathjax_config['tex2jax']) — MyST-Parser requires Sphinx ≥ 8mathjax4_configsupport: prefer whichever config the user has explicitly set, falling back to the Sphinx version's default (mathjax4_configfor Sphinx 9+,mathjax3_configfor 8)processHtmlClassis always applied even when no user mathjax config is pre-setlog_override_warningto use the actual config attribute nameTests added
test_mathjax_default— verifiesprocessHtmlClassis set with no user configtest_mathjax_no_override— verifiesmyst_update_mathjax=Falseskips overridetest_mathjax4_warning— verifies warning when overridingmathjax4_config(Sphinx 9+)test_mathjax3_config_on_sphinx9— verifies explicitmathjax3_configis still respected on Sphinx 9